import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:palyer/app/core/values/dimens.dart';

import 'package:palyer/app/core/values/values.dart';


class LoadingWidget extends StatelessWidget {
  const LoadingWidget({
    Key? key,
    this.fullPage = true,
    this.height,
  }) : super(key: key);

  // 是否覆盖整页
  final bool fullPage;

  // 设置高度
  final double? height;

  @override
  Widget build(BuildContext context) {
    final Widget widget = SizedBox(
      height: AppDimens.dp24,
      child: const Center(
        child: CupertinoActivityIndicator(),
      ),
    );

    return fullPage
        ? Container(
            constraints: BoxConstraints.expand(height: height),
            child: Center(
              child: widget
            ),
          )
        : Card(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20),
            ),
            color: AppColors.text_background_grey,
            child: Container(
              alignment: Alignment.center,
              width: AppDimens.dp200,
              height: AppDimens.dp200,
              child: widget,
            ),
          );
  }
}
